<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
	</head>

	<body style="padding: 0;">
		<div class="easyui-layout" style="width:100%;height:550px;">
			<div data-options="region:'center'">
				<div id="p" class="easyui-panel" style="width:100%;height:100%;padding:0px;">
					<div>
						<table id="dg" style="width: 100%;" class="table_style">
						</table>
					</div>
					<div id="toolbar"></div>
				</div>
			</div>
		</div>
		<div id="div_dialog" class="easyui-dialog" closed="true">
			<form id="fm" style="width: 400px;height: 200px; ;"></form>
		</div>
	</body>
	<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
	<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../../JS/common.js"></script>
	<script type="text/javascript" src="../../../JS/buildDialogSearch.js"></script>
	<script>
		var searchType = SEARCH_DISTRIBUTION_DATE_START + SEARCH_DISTRIBUTION_DATE_END + SEARCH_CUSTOMER_NAME;
		var content = buildSearchOptions(searchType, "");
		console.log(content);
		$("#fm").append(content);
		content = AddReceiptsToolBar(3200, ""); /**根据用户的权限，来决定生成ToolBar的哪些功能**/
		$("#toolbar").append(content); /*在ID=toolbar的标记后面添加content中的内容*/
		$('#dg').datagrid({
			url: RemoteLinkAddress + '/logistics/salesorder/list.do',
			toolbar: '#toolbar',
			method: 'get',
			rownumbers: 'true',
			pagination: 'true',
			autoRowHeight: 'true',
			fitColumns: 'false',
			singleSelect: 'true',
			height: 350,
			columns: [
				[{
					field: 'ID',
					title: 'ID',
					width: '0%',
					align: 'center'
				}, {
					field: 'ORDER_NO',
					title: '销售单号',
					width: '13%',
					align: 'center'
				}, {
					field: 'CUSTOMER_TYPE',
					title: '用户组',
					width: '13%',
					align: 'center'
				}, {
					field: 'CUSTOMER_NAME',
					title: '配送单位',
					width: '13%',
					align: 'center'
				}, {
					field: 'DISTRIBUTION_DATE',
					title: '配送时间',
					width: '13%',
					align: 'center'
				}, {
					field: 'LUMP_SUM',
					title: '总价',
					width: '13%',
					align: 'center',
					formatter: function(value, row, index) {
						if(value) {
							return "￥" + value + "元";
						}
					}
				}, {
					field: 'STATE',
					title: '订单状态',
					width: "13%",
					align: 'center'
				}, {
					field: 'ISVERIFY',
					title: '审核状态',
					width: '14%',
					align: 'center',
					formatter: function(value, row, index) {
						return verifyStatus(value, false);
					}
				}]
			],
			onDblClickRow:function(index,row){
				var pLocation = "";
				pLocation = "UI/LOGISTICS/SellOrder/SellOrderAdd.html?id=" + row.ID;
				AddTabIn("销售订单详情", parent.$("#tabs"), pLocation);
				console.log(pLocation);
			},
		});
		
		$('#dg').datagrid('hideColumn', 'ID');
		
		$('#search_customr_name').combobox({
			valueField: 'CUSTOMER_NAME',
			textField: 'CUSTOMER_NAME',
			panelHeight: 200,
			mode: 'remote',
			method: 'get',
			url: RemoteLinkAddress + '/logistics/customer/listall.do',
			onChange: function(newValue, oldValue) {
				if(newValue != "" && newValue != undefined) {
					var url = RemoteLinkAddress + "/logistics/customer/findbypinyin?PINYINFIELDNAME=" + newValue.trim();
					$(this).combobox("reload", url);
				}
			}
		});

		function searchmore() {
			$('#div_dialog').dialog('open').dialog('center').dialog('setTitle', '查询');
			$('#fm').form('clear');
		}

		function doSearch() {
			$('#div_dialog').dialog('close');
			var searchCondition = processSearchCondition();
			var _url = RemoteLinkAddress + '/logistics/salesorder/list.do?' + searchCondition;
			$('#dg').datagrid('options').url = _url;
			$('#dg').datagrid('reload');
		}
		
		function closeForm(){
			$('#div_dialog').dialog('close');
		}
		
		function redodata(){
			checkAllData("/logistics/salesorder/list.do");
		}
	</script>

</html>